package com.example.partition;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class Employee  implements Writable {
    //7499,ALLEN,SALESMAN,7698,1981/2/20,1600,300,30
    //员工编号
    private int empno;
    //员工姓名
    private String ename;
    //职位
    private String  job;
    //经理id
    private int mgr;
    //入职时间
    private String hiredate;
    //工资
    private int sal;
    //奖金
    private int comm;
    //部门编号
    private int deptno;


    //序列化
    @Override
    public void write(DataOutput out) throws IOException {
          out.writeInt(empno);
          out.writeUTF(ename);
          out.writeUTF(job);
          out.writeInt(mgr);
          out.writeUTF(hiredate);
          out.writeInt(sal);
          out.writeInt(comm);
          out.writeInt(deptno);

    }

    //反序列化
    @Override
    public void readFields(DataInput in) throws IOException {
        this.empno=in.readInt();
        this.ename=in.readUTF();
        this.job=in.readUTF();
        this.mgr=in.readInt();
        this.hiredate=in.readUTF();
        this.sal=in.readInt();
        this.comm=in.readInt();
        this.deptno=in.readInt();
    }

    public int getEmpno() {
        return empno;
    }

    public void setEmpno(int empno) {
        this.empno = empno;
    }

    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public int getMgr() {
        return mgr;
    }

    public void setMgr(int mgr) {
        this.mgr = mgr;
    }

    public String getHiredate() {
        return hiredate;
    }

    public void setHiredate(String hiredate) {
        this.hiredate = hiredate;
    }

    public int getSal() {
        return sal;
    }

    public void setSal(int sal) {
        this.sal = sal;
    }

    public int getComm() {
        return comm;
    }

    public void setComm(int comm) {
        this.comm = comm;
    }

    public int getDeptno() {
        return deptno;
    }

    public void setDeptno(int deptno) {
        this.deptno = deptno;
    }
}
